{{include file="menu2.html"}}
	<!-- 添加到购物车 -->
	<div id="flyItem" class="fly_item">
		<img src="" width="50" height="50"/>
	</div>
	<script type="text/javascript" src="{{$smarty.const.__APP__}}js/parabola.js"></script>
	<script type="text/javascript">
		function shop_cart(){

			//元素以及其他一些变量
			var eleFlyElement = document.querySelector("#flyItem"), eleShopCart = document.querySelector("#shopCart");
			var numberItem = 0;
			// 抛物线运动
			var myParabola = funParabola(eleFlyElement, eleShopCart, {
				speed: 500, //抛物线速度
				curvature: 0.0008, //控制抛物线弧度
				complete: function() {
					eleFlyElement.style.visibility = "hidden";
				}
			});
			if (eleFlyElement && eleShopCart) {
				[].slice.call(document.getElementsByClassName("cart")).forEach(function(button) {
						button.addEventListener("click", function(event) {
							
							var src = $(this).parents('.i_li').find('.img_inner img').attr("src");
							$("#flyItem").find("img").attr("src", src);
							// 滚动大小
							var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft || 0,
									scrollTop = document.documentElement.scrollTop || document.body.scrollTop || 0;
							eleFlyElement.style.left = event.clientX + scrollLeft + "px";
							eleFlyElement.style.top = event.clientY + scrollTop + "px";
							eleFlyElement.style.visibility = "visible";
				
							// 需要重定位
							myParabola.position().move();
						});
				});
			}
		}

		function addcart(id){
			$.get('{{"index.php?app=Car&act=addToCart"|URL}}',{'goodsid':id},function(xml){
			if(xml.statusCode == '200'){
				ui.success('加入购物成功！');
				$.cookie('car_number',xml.message,{expires: null,path: "/"});
				$("#shopCart i").text(xml.message);
			}else if(xml.statusCode == '201'){
				ui.alert(xml.message);
                $.cookie('history_url', window.location.href, {expires: null,path: "/"});
            	setTimeout(function(){
					location.href='{{"index.php?app=Login"|URL}}';
				},1000);
			}else if(xml.statusCode == '202'){
				ui.alert(xml.message);
			}
	 		},'json');
		}
	</script>
</body>
</html>